/**
 * 前端登录业务类
 * @author singwa
 */
var login = {
    check : function(){
        var username = $('input[name="username"]').val();
        var password = $('input[name="password"]').val();
        var code = $('input[name="code"]').val();
        if(!username){
            dialog.error("用户名不能为空");
            return false;
        }
        if(!password){
            dialog.error("密码不能为空");
            return false;
        }
        if(!code){
            dialog.error("验证码不能为空");
            return false;
        }
        var url = "check";
        var data = {'username':username,'password':password,'code':code};
        $.post(url,data,function(result){
            if(result.status == 0){
                dialog.error(result.message);
            }
            if(result.status == 1){
                dialog.success(result.message,"../index/index");
            }
        },'JSON');
    },
    loginOut : function(){
        var url = "../login/loginOut";
        $.post(url,function(result){
            if(result.status == 0){
                dialog.error(result.message);
            }
            if(result.status == 1){
                dialog.success(result.message,'../login/index');
            }
        },'JSON');
    },
}